package com.byd.dms.fastjson;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.byd.dms.enums.Status;
import com.byd.dms.enums.StatusSerializer;
import com.byd.dms.vo.SysDictItemSelectVo;
import com.byd.dms.vo.ToSystemNameSerializer;
import org.junit.jupiter.api.Test;

/**
 * https://blog.csdn.net/qq_27706119/article/details/104828285
 */
public class SerialaizerDemo {
    
    
    @Test
    public void serialaizer() {
        SysDictItemSelectVo sysDictItemSelectVo = new SysDictItemSelectVo("刘阿勇", "lyy");
        System.out.println("sysDictItemSelectVo = " + sysDictItemSelectVo);
        String s = JSON.toJSONString(sysDictItemSelectVo);
        System.out.println("s = " + s);
    }
    
    
    @Test
    public void serialaizer2() {
        SerializeConfig config = new SerializeConfig();
        config.put(SysDictItemSelectVo.class, new ToSystemNameSerializer());
        SysDictItemSelectVo sysDictItemSelectVo = new SysDictItemSelectVo("刘阿勇", "lyy");
        System.out.println("sysDictItemSelectVo = " + sysDictItemSelectVo);
        String s = JSON.toJSONString(sysDictItemSelectVo, config);
        System.out.println("s = " + s);
    }
    
    
}
